import request from '@/utils/request'

// 查询优惠券列表
export function listCoupon(query: any) {
  return request({
    url: '/app/coupon/list',
    method: 'get',
    params: query
  })
}

// 查询优惠券详细
export function getCoupon(couponId: number) {
  return request({
    url: '/app/coupon/' + couponId,
    method: 'get'
  })
}

// 新增优惠券
export function addCoupon(data: any) {
  return request({
    url: '/app/coupon',
    method: 'post',
    data: data
  })
}

// 修改优惠券
export function updateCoupon(data: any) {
  return request({
    url: '/app/coupon',
    method: 'put',
    data: data
  })
}

// 删除优惠券
export function delCoupon(couponIds: number | number[]) {
  return request({
    url: '/app/coupon/' + couponIds,
    method: 'delete'
  })
}

// 获取新人优惠券列表
export function getNewCouponList() {
  return request({
    url: '/app/coupon/newList',
    method: 'get'
  })
}

// 领取优惠券
export function applyCoupon(data: any) {
  return request({
    url: '/app/coupon/apply',
    method: 'post',
    data: data
  })
} 